package com.hk.panel;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;

import com.hk.BlackJack;
import com.hk.global.Constance;
import com.hk.global.ImageUrl;
import com.hk.global.PanelState;

@SuppressWarnings("serial")
public class FirstPanel extends JPanel{
	private JButton startBtn;
	private ImageIcon icon;
	
	@Override
	public void paintComponent(Graphics g) {
		icon = new ImageIcon(ImageUrl.G_START);
		g.drawImage(icon.getImage(), 0, 0, Constance.WIDTH, Constance.HEIGHT, null);
	}
	public FirstPanel(){
		setBounds(0, 0, Constance.WIDTH, Constance.HEIGHT);
		
		setLayout(null);
		startBtn = new JButton("Start");
		startBtn.setOpaque(false);
		startBtn.setBorderPainted(false);
		startBtn.setIcon(new ImageIcon(ImageUrl.B_PLAY));
		startBtn.setBackground(new Color(200, 100, 200));
		startBtn.setBackground(new Color(0, 0, 0));
		startBtn.setFont(new Font("Serif", Font.PLAIN, 0));
		startBtn.setBounds(Constance.WIDTH/3,Constance.HEIGHT/3 * 2,300,100);
		startBtn.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				BlackJack.state = PanelState.SETTING;
				BlackJack.update();
			}
		});
		add(startBtn);	
	}
}

